#!/usr/bin/env python3
# coding=utf-8

import numpy as np
import cv2


gk = cv2.getGaussianKernel(3, 1)
print(gk)

#二维高斯卷积核
def GetGaussianKernel2D(ksize, sigma):
    kernelX = cv2.getGaussianKernel(
        ksize[0], sigma).reshape(ksize[0], 1)  # 行向量
    kernelY = cv2.getGaussianKernel(
        ksize[1], sigma).reshape(1, ksize[1])  # 列向量
    kernel = kernelX * kernelY
    return kernel

gk2 = GetGaussianKernel2D((3,3), 1)
print(gk2)